﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;
using System.Drawing;

namespace FingerVein_Database_Collection
{
    class ImageByteConv
    {

        public static byte[] ImagetoByte(Bitmap img)
        {
            MemoryStream msMain = new MemoryStream();
            img.Save(msMain, System.Drawing.Imaging.ImageFormat.Bmp);
            byte[] dataMain = msMain.GetBuffer();
            return dataMain;
        }


        public static Bitmap ByteArrayToImage(byte[] byteArrayIn)
        {
            var ms = new MemoryStream(byteArrayIn);
            Bitmap returnImage = (Bitmap)Bitmap.FromStream(ms);
            return returnImage;
        }

    }
}
